# @Time : 2020/7/17 10:07
# @Author : Fioman 
# @Phone : 13149920693
"""
如何将一幅图像拼接到另外一幅图像上面去呢?
1> 将一个感兴趣区域A赋值给变量B后,可以将该变量B赋值给另外一个区域C,从而达到在区域C内复制区域A的目的.
2> img[100:200,300:400]  表示的ROI区域是 100到200行, 300到400列.
"""
import cv2 as cv
import numpy as np


img = cv.imread("lena.bmp",cv.IMREAD_GRAYSCALE)
face = img[269:423,256:366]
cv.imshow("Original",img)
cv.imshow("Face",face)

cv.waitKey(0)
cv.destroyAllWindows()

# 对脸部进行打码
newFace = np.random.randint(0,256,(face.shape[0],face.shape[1]))
img[269:423,256:366] = newFace

cv.imshow("result",img)
cv.waitKey(0)
cv.destroyAllWindows()